Skip to content

fix(cascade): rp_filter relax + idempotent transit route#9

Merged
bodaay merged 2 commits into
mainfrom
fix/cascade-rp-filter
Jun 5, 2026
Merged

fix(cascade): rp_filter relax + idempotent transit route#9
bodaay merged 2 commits into
mainfrom
fix/cascade-rp-filter

Conversation

@bodaay

@bodaay bodaay commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Cascade black-hole + 2nd-device-bind failures the live nyc→ams test surfaced:

  • rp_filter: relaxed only conf.all.rp_filter=0, but effective = max(all, iface) so the receiving inner interface stayed at the inherited 2 and returns were dropped. Now relax default too (new wg interfaces inherit 0) and stop resetting to 2 on teardown. Also baked into deploy/cloud-init.sh.
  • ip route add ... tableip route replace (idempotent; a 2nd device on the same path no longer 502s "File exists").

netpolicy_test pins both, kept byte-identical with coxswain's renderer.

🤖 Generated with Claude Code

bodaay and others added 2 commits June 5, 2026 04:08
Cascade routing is asymmetric — a device's packets reach the exit on the
inner-link adapter while the return path leaves a different interface. Reverse-
path filtering (even Ubuntu's default "loose" rp_filter=2) silently drops those
packets, so 2-hop egress black-holes while single-hop works. Set
net.ipv4.conf.{all,default}.rp_filter=0 in the node's sysctl prep (next to
ip_forward); new awg interfaces inherit the default.

Confirmed live: nyc(entry)→ams(exit) cascade — client egress flipped from the
entry's IP to the exit's IP the instant rp_filter was turned off.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The cascade black-hole had two code causes the live test surfaced:

- rp_filter: the transit rules set only `conf.all.rp_filter=0`, but the effective
  value is max(conf.all, conf.<iface>), so the receiving inner interface stayed at
  its inherited default (2) and returns were still dropped — `all=0` alone was a
  no-op. Now relax `default` too (new wg interfaces inherit 0) and stop resetting
  `all` to 2 on teardown (that re-broke any other transit still up).
- `ip route add default dev <inner> table <table>` is non-idempotent: a 2nd device
  binding the same path 502s with "File exists". Use `ip route replace`.

netpolicy_test pins both (and that teardown never sets rp_filter=2); kept
byte-identical with coxswain's renderer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bodaay bodaay merged commit db9a1e3 into main Jun 5, 2026
1 of 2 checks passed
@bodaay bodaay deleted the fix/cascade-rp-filter branch June 5, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant